<template>
	<view class="content">
		<newItem :newsList='newsList' @itemClick='goNewsDetail'></newItem>
	</view>

</template>

<script>
	import newItem from "../../components/newItem/newItem.vue"
	export default {

		data() {
			return {
				newsList: []
			}
		},
		onLoad() {
			this.getNewsList()
		},
		methods: {
			async getNewsList() {
				const res = await this.$myRequest({
					url: '/api/getnewslist'
				})
				this.newsList = res.data.message
				console.log(this.newsList);
			},
			goNewsDetail(id) {
				uni.navigateTo({
					url: '/pages/newsDetail/newsDetail?id=' + id
				})
			}
		},
		components: {
			newItem
		}
	}
</script>

<style lang="scss">
</style>
